import App from './App'
import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate'
import './utils/utils.js'

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
	const pinia = createPinia()
	const app = createSSRApp(App)
	pinia.use(
		// 自定义 Pinia 插件
		createPersistedState({
			// 自定义本地存储的逻辑
			storage: {
				setItem(key, value) {
					uni.setStorageSync(key, value)
				},
				getItem(key) {
					return uni.getStorageSync(key)
				},
			},
		})
	)
	app.use(pinia)
	return {
		app,
	}
}
// #endif
